package com.chenchao.javabase;

/**
 * @coding : utf-8
 * @Time : 2020/11/6 13:07
 * @author : chenchao
 * @File : java实例变量.java
 * @Software: IntelliJ IDEA
 */
public class Javavariable {
    static int count;//类变量，从属于类

    int age;//实例变量，从属于实例对象
    String name;
    char c;
    //变量没有赋予初值，会给默认值，
    //数值型默认0，0.0，char \u0000(即为0编码)
    //boolean型默认False
    //引用型默认null
    public static void main(String[] args) {
        Javavariable java变量 = new Javavariable();
        int age = 0;//局部变量,作用域在方法里面,必须初始化

        System.out.println(java变量.age);
        System.out.println(java变量.c);
        System.out.println(age);
    }

    /**
     *
     * @return
     */
    public static int getCount() {
        return count;
    }

    /**
     *
     * @param count
     */
    public static void setCount(int count) {
        Javavariable.count = count;
    }

    /**
     *
     * @return
     */
    public int getAge() {
        return age;
    }

    /**
     *
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     *
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     *
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    public char getC() {
        return c;
    }

    public void setC(char c) {
        this.c = c;
    }
}
